package com.cjy.random;

import java.util.Random;

public class RandomText {
    public static void main(String[] args) {
        Random ran = new Random();
        //获取一个随机的int数字3（范围是0-2）就如[0，3)
        //本来范围是[0,n),整体加1后变成了[1,n+1)
        for (int i=0;i<3;i++){
            int s = ran.nextInt(3)+1;
            System.out.println(s);
        }


        String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        Random random=new Random();
        StringBuffer sb=new StringBuffer();
        for(int i=0;i<5;i++) {
            int number = random.nextInt(62);
            sb.append(str.charAt(number));
        }
        System.out.println(sb);
    }
}
